﻿package net.wangit.jdbc.transaction;

import javax.naming.InitialContext;
import javax.transaction.TransactionManager;

public class JOTMTransaction extends JTATransaction {

	public JOTMTransaction() {
	}

	public TransactionManager getTransactionManager(InitialContext context)
			throws TransactionException {
		try {
			Class clazz = Class.forName("org.objectweb.jotm.Current");
			return (TransactionManager) clazz.getMethod(
					"getTransactionManager", null).invoke(null, null);
		} catch (Exception e) {
			throw new TransactionException(
					"Could not obtain JOTM transaction manager instance", e);
		}
	}

	public String getUserTransactionName() {
		return "java:comp/UserTransaction";
	}
}
